package top.tangyh.lamp.care.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import top.tangyh.lamp.care.mapper.BObsvCfgDetailMapper;
import top.tangyh.lamp.care.service.BObsvCfgDetailService;
import top.tangyh.basic.base.service.impl.SuperServiceImpl;
import top.tangyh.lamp.care.manager.BObsvCfgDetailManager;
import top.tangyh.lamp.care.entity.BObsvCfgDetail;
import top.tangyh.lamp.care.vo.result.ObsvCfgDetailDto;
import top.tangyh.lamp.care.vo.save.BObsvCfgDetailSaveVO;
import top.tangyh.lamp.care.vo.update.BObsvCfgDetailUpdateVO;
import top.tangyh.lamp.care.vo.result.BObsvCfgDetailResultVO;
import top.tangyh.lamp.care.vo.query.BObsvCfgDetailPageQuery;
import top.tangyh.lamp.common.utils.ConvertUtil;

import java.util.List;

/**
 * <p>
 * 业务实现类
 * 观察项配置明细表
 * </p>
 *
 * @author zqb
 * @date 2024-07-26 10:31:53
 * @create [2024-07-26 10:31:53] [zqb] [代码生成器生成]
 */
@Slf4j
@RequiredArgsConstructor
@Service
@Transactional(readOnly = true)
public class BObsvCfgDetailServiceImpl extends SuperServiceImpl<BObsvCfgDetailManager, Long, BObsvCfgDetail> implements BObsvCfgDetailService {

    private final BObsvCfgDetailMapper bObsvCfgDetailMapper;
    @Override
    public List<ObsvCfgDetailDto> selectByCfgId(Long id) {
        LambdaQueryWrapper<BObsvCfgDetail> queryWrapper = new LambdaQueryWrapper<>();
        queryWrapper.eq(BObsvCfgDetail::getObsvCfgId, id);
        List<BObsvCfgDetail> obsvCfgDetails = bObsvCfgDetailMapper.selectList(queryWrapper);
        return ConvertUtil.convertList(obsvCfgDetails, ObsvCfgDetailDto.class);

    }

    /**
     * 根据观察项主表的id获得所有含有该主表项的结构体的明细
     *
     * @param obsvCfgId 观察项主表id
     * @return
     */
    @Override
    public List<BObsvCfgDetail> findByObsvCfgId(Long obsvCfgId) {
        return bObsvCfgDetailMapper.findByObsvCfgId(obsvCfgId);
    }

}


